home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / macro28.lha / Macro / FinsGold / Modula / m2c.ged < prev    next >
Encoding:
Text File  |  1994-06-14  |  3.7 KB  |  154 lines

  1. /* m2c.ged $VER: 0.52 m2c.ged © 1994 Fin Schuppenhauer (13.06.94) */
  2.  
  3. OPTIONS RESULTS                             /* enable return codes     */
  4.  
  5. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  6.     address 'GOLDED.1'
  7.  
  8. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  9. OPTIONS FAILAT 6                            /* ignore warnings         */
  10. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  11.  
  12.  
  13. /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
  14.  
  15.  
  16. 'QUERY CAT'
  17. german = (result = "deutsch")
  18.  
  19. /* Dateinamen ermitteln: */
  20. 'QUERY FILE VAR FILENAME'
  21. if (right(filename, 4) ~= '.def') & (right(filename, 4) ~= '.mod') then do
  22.    if german then
  23.       'REQUEST BODY="Dies ist kein Modula-2-Quelltext!"'
  24.    else
  25.       'REQUEST BODY="This is no modula-2 source!"'
  26.    'UNLOCK'
  27.    EXIT
  28. end
  29.  
  30. /* Gibt es überhaupt etwas zu übersetzen ? */
  31. 'QUERY ANYTEXT'
  32. if result = 'FALSE' then do
  33.    if german then
  34.       'REQUEST BODY="Ähmm, was soll ich den übersetzen?"'
  35.    else
  36.       'REQUEST BODY="There''s no source to compile!"'
  37.    'UNLOCK'
  38.    EXIT
  39. end
  40.  
  41. /* Text verändert? Wenn ja, vorher sichern. */
  42. 'QUERY MODIFY'
  43. if result = 'TRUE' then
  44.    'SAVE ALL'
  45.  
  46. /* Ist der Compiler aktiv ? */
  47. if ~show('P', 'M2C') then do
  48.    if german then
  49.       'REQUEST BODY="Der Compiler läuft nicht!||Bitte starten."'
  50.    else
  51.       'REQUEST BODY="The Compiler is not running!||Please start."'
  52.    'UNLOCK'
  53.    EXIT
  54. end
  55.  
  56. /* Compiler-Optionen ermitteln (sind alle per Default TRUE) */
  57. compopt = "-"
  58. 'QUERY USER1'                 /* StackChk */
  59. if result='FALSE' then
  60.    compopt = compopt || "s"
  61.  
  62. 'QUERY USER2'                 /* RangeChk */
  63. if result='FALSE' then
  64.    compopt = compopt || "r"
  65.  
  66. 'QUERY USER3'                 /* OverflowChk */
  67. if result='FALSE' then
  68.    compopt = compopt || "v"
  69.  
  70. 'QUERY USER4'                 /* NilChk */
  71. if result='FALSE' then
  72.    compopt = compopt || "n"
  73.  
  74. 'QUERY USER5'                 /* EntryClear */
  75. if result='FALSE' then
  76.    compopt = compopt || "e"
  77.  
  78. 'QUERY USER6'                 /* CaseChk */
  79. if result='FALSE' then
  80.    compopt = compopt || "c"
  81.  
  82. 'QUERY USER7'                 /* ReturnChk */
  83. if result='FALSE' then
  84.    compopt = compopt || "f"
  85.  
  86. 'QUERY USER8'                 /* LongAlign */
  87. if result='FALSE' then
  88.    compopt = compopt || "l"
  89.  
  90. 'QUERY USER9'                 /* Volatile */
  91. if result='FALSE' then
  92.    compopt = compopt || "h"
  93.  
  94. 'QUERY USER10'                 /* LargeVars */
  95. if result='FALSE' then
  96.    compopt = compopt || "y"
  97.  
  98. 'QUERY USER11'                 /* StackParms */
  99. if result='FALSE' then
  100.    compopt = compopt || "z"
  101.  
  102. /* Optimieren und/oder Debug-Informationen ? */
  103. 'QUERY USER12 VAR OPT'        /* Optimieren ? */
  104. 'QUERY USER13 VAR DBG'        /* Debug-Info ? */
  105. if (opt = 'TRUE') & (dbg = 'TRUE') then
  106.    optdbg = "+@"
  107. if (opt = 'TRUE') & (dbg = 'FALSE') then
  108.    optdbg = "-d"
  109. if (opt = 'FALSE') & (dbg = 'TRUE') then
  110.    optdbg = "+d"
  111. if (opt = 'FALSE') & (dbg = 'FALSE') then
  112.    optdbg = "-@"
  113.  
  114. /* Piktogramme erzeugen? */
  115. 'QUERY USER14'
  116. if result = 'TRUE' then
  117.    icons = "+i"
  118. else
  119.    icons = "-i"
  120.  
  121. if german then
  122.    'REQUEST STATUS="Übersetze nun 'filename' ..."'
  123. else
  124.    'REQUEST STATUS="Compiling 'filename' ..."'
  125.  
  126. OPTIONS FAILAT 21
  127. ADDRESS 'M2C' "COMPILE " || compopt || optdbg || icons || " " || filename
  128.  
  129. 'REQUEST STATUS=""'
  130.  
  131. if rc ~= 0 then do
  132.    if german then
  133.       'REQUEST BODY="Es sind Fehler aufgetreten!"'
  134.    else
  135.       'REQUEST BODY="Some errors occured!"'
  136. end
  137. else do
  138.    if german then
  139.       'REQUEST BODY="Erfolgreiche Übersetzung."'
  140.    else
  141.       'REQUEST BODY="Successfull compilation."'
  142. end
  143.  
  144. /* ---------------------------- END OF YOUR CODE --------------------- */
  145.  
  146. 'UNLOCK' /* VERY important: unlock GUI */
  147. EXIT
  148.  
  149. SYNTAX:
  150.  
  151. SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  152. 'UNLOCK'
  153. EXIT
  154.